﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Born : MonoBehaviour {

	public GameObject playerPrefab;
	public GameObject[] EnemyPrefabs;
	public bool createPlayer;

	// Use this for initialization
	void Start () {
		Invoke("InitTank", 0.8f);
		Destroy(gameObject, 0.8f);
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	private void InitTank() {
		if (createPlayer)
		{//创建玩家
			Instantiate(playerPrefab, transform.position, Quaternion.identity);
		}
		else {
			//创建敌人
			int range = Random.Range(0,2);
			Instantiate(EnemyPrefabs[range], transform.position, Quaternion.identity);
		}
		
	}
}
